home *** CD-ROM | disk | FTP | other *** search
File List | 1986-10-19 | 1.5 KB | 76 lines |
- ' ********************
- ' *** FUNCTION.LST ***
- ' ********************
- '
- DEFWRD "a-z"
- '
- FUNCTION before$(source$,target$)
- ' *** returns part of source$ before target$
- ' *** returns complete source$ if no target$ found
- LOCAL p
- p=INSTR(source$,target$)
- IF p=0
- RETURN source$
- ELSE
- RETURN LEFT$(source$,p-1)
- ENDIF
- ENDFUNC
- ' **********
- '
- FUNCTION after$(source$,target$)
- ' *** returns part of source$ after target$
- ' *** returns nullstring if no target$ found
- LOCAL p
- p=INSTR(source$,target$)
- IF p=0
- RETURN ""
- ELSE
- RETURN MID$(source$,p+LEN(target$))
- ENDIF
- ENDFUNC
- ' **********
- '
- FUNCTION intel.word(x%)
- ' *** swap low byte and high byte of word (to/from Intel-format)
- RETURN CARD(ROR&(x%,8))
- ENDFUNC
- ' **********
- '
- FUNCTION digital$(number$)
- ' *** return number with LCD-digits (ASCII-codes 16-25)
- ' *** use as : TEXT x,y,@digital$("1237")
- LOCAL dig$,i
- CLR dig$
- FOR i=1 TO LEN(number$)
- dig$=dig$+CHR$(BCLR(ASC(MID$(number$,i,1)),5))
- NEXT i
- RETURN dig$
- ENDFUNC
- ' **********
- '
- FUNCTION multiple(n%,fac)
- ' *** returns smallest multiple of fac ≥ n% (n%>0)
- LOCAL m
- m=MOD(n%,fac)
- IF m>0
- RETURN n%+fac-m
- ELSE
- RETURN n%
- ENDIF
- ENDFUNC
- ' **********
- '
- FUNCTION lower$(t$)
- ' *** converts all upper case letters in t$ to lower case
- LOCAL i,a%,c|
- adr%=V:t$
- FOR i=0 TO PRED(LEN(t$))
- a%=ADD(adr%,i)
- c|=BYTE{a%}
- IF c|>=65 AND c|<=90
- BYTE{a%}=BSET(c|,5)
- ENDIF
- NEXT i
- RETURN t$
- ENDFUNC
-